from PIL import Image, ImageDraw, ImageFont
import os

def create_icon():
    # 创建一个 256x256 的图像
    size = 256
    image = Image.new('RGBA', (size, size), (255, 255, 255, 0))
    draw = ImageDraw.Draw(image)
    
    # 绘制圆形背景
    circle_color = (74, 144, 226)  # 蓝色
    draw.ellipse([20, 20, size-20, size-20], fill=circle_color)
    
    # 绘制书本图标
    book_color = (255, 255, 255)  # 白色
    # 书本主体
    draw.rectangle([80, 60, 176, 196], fill=book_color)
    # 书本装饰线
    for y in range(80, 196, 20):
        draw.line([80, y, 176, y], fill=circle_color, width=2)
    
    # 保存为 ICO 文件
    image.save('icon.ico', format='ICO', sizes=[(256, 256)])

if __name__ == '__main__':
    create_icon() 